﻿using BUS;
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyWeb.GUI.User
{
    public partial class DangKi : System.Web.UI.Page
    {
        NguoiDungDTO objND = new NguoiDungDTO();
        NguoiDungBUS ndbus = new NguoiDungBUS();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnDangki_Click(object sender, EventArgs e)
        {
            objND.Email = txtEmail.Text;
            objND.MatKhau = txtmk.Text;
            objND.SDT = txtSdt.Text;
            objND.TrangThai = true;
            objND.NgayDangKi = DateTime.Now;
            objND.DiaChi = txtDiachi.Text;
            objND.Hoten = txthoten.Text;
            objND.LastChange = DateTime.Now;
            objND.MaPQ = 3;
            if (ndbus.DangKi(objND))
            {
                Response.Write("<script>alert('Đăng kí thành công');window.location='TrangChu.aspx'</script>");
            }
            else
                Response.Write("<script>alert('Đăng kí thất bại');window.location='DangKi.aspx'</script>");
        }
    }
}